[GLUTEN-12468][FLINK] Handle WatermarkStatus elements in GlutenSourceFunction#12461
[GLUTEN-12468][FLINK] Handle WatermarkStatus elements in GlutenSourceFunction#12461lgbo-ustc wants to merge 17 commits into
Conversation
Add processing for WatermarkStatus elements from native idle detection. When IDLE is received, call sourceContext.markAsTemporarilyIdle() to notify Flink that this source is temporarily idle, allowing watermark progress to continue from other sources.
Adds GlutenSourceFunctionWatermarkStatusTest with 5 test cases covering: - IDLE status triggers markAsTemporarilyIdle() - ACTIVE status is a no-op on SourceContext - IDLE→ACTIVE transition does not call markAsTemporarilyIdle() - Repeated IDLE calls are idempotent - ACTIVE status produces no invocations Uses reflection to invoke private processWatermarkStatus() and a custom TrackingSourceContext spy — no Mockito or native session required.
…bounded test scenarios
…uster - Add GlutenStreamSource.isShouldCallNoMoreSplits() delegating to source - Add GlutenSourceFunction.isShouldCallNoMoreSplits() getter - Extend OffloadedJobGraphGenerator to preserve shouldCallNoMoreSplits when creating a new GlutenSourceFunction during offloading - Rewrite GlutenSourceFunctionWatermarkStatusE2ETest as a real E2E test using embedded Kafka broker + Flink MiniCluster, verifying that WatermarkStatus.IDLE is emitted after idle timeout - Fix EmptyNode output type in WatermarkPushDownSpec project to match table scan schema (avoids FieldNotFound error during plan init)
Covered by GlutenSourceFunctionWatermarkStatusE2ETest which tests the same behavior end-to-end with Kafka + MiniCluster.
Add testIdleInputExcludedFromMinWatermark to GlutenStreamTwoInputWatermarkStatusTest: when one input is marked IDLE, its watermark is excluded from min-watermark calculation so the other active input can advance freely.
3342506 to
9cd1b66
Compare
KevinyhZou
left a comment
There was a problem hiding this comment.
One suggestion on API surface: please tighten shouldCallNoMoreSplits so it stays a test/unbounded-split concern rather than a public production toggle (details in the inline comment on GlutenSourceFunction).
There was a problem hiding this comment.
Please tighten / 收敛 shouldCallNoMoreSplits
This flag is introduced mainly so the idle E2E test can keep the native task alive (skip task.noMoreSplits(id) after the initial split). That need is valid, but the current shape turns a test knob into a public production API:
public void setShouldCallNoMoreSplits(boolean value) { ... }
public boolean isShouldCallNoMoreSplits() { ... }and it is also propagated through OffloadedJobGraphGenerator / GlutenStreamSource.
Risks:
- Accidental
falsein production changes split lifecycle semantics. - Offload path now has to carry a UT-oriented toggle as a first-class field.
- Naming/
settersurface suggests general configuration, but docs say it is for “unbounded streaming test scenarios”.
Suggestions (any one is fine):
- Prefer a constructor param or package-private /
@VisibleForTestingAPI instead of a public setter. - Avoid wiring this through
OffloadedJobGraphGeneratorunless production offload truly needs a non-default value (default should staytrue). - Longer term: derive from connector/split boundedness (unbounded Kafka → don’t auto
noMoreSplits) rather than a hand-set boolean.
Functionality can stay; please just shrink visibility and keep it out of the general runtime surface.
What changes are proposed in this pull request?
Add processing for WatermarkStatus elements from native idle detection. When IDLE is received, call sourceContext.markAsTemporarilyIdle() to notify Flink that this source is temporarily idle, allowing watermark progress to continue from other sources.
Related PRs:
closed: #12468
How was this patch tested?
UTs
Was this patch authored or co-authored using generative AI tooling?
Generated-by: deepseek v4 pro